/**
 * 
 */
package gov.nih.nlm.lowlinc.owlapi;

import org.apache.log4j.Logger;
import org.semanticweb.owlapi.reasoner.ReasonerProgressMonitor;

/**
 * @author Tomasz Adamusiak
 * 
 */
public class LowlincProgressMonitor implements ReasonerProgressMonitor {
	private static final Logger log = Logger
			.getLogger(LowlincProgressMonitor.class);
	private Integer lastPercentage = 0;

	@Override
	public void reasonerTaskStarted(String taskName) {
		log.info(taskName);
	}

	@Override
	public void reasonerTaskStopped() {
		log.info("...reasoning finished");
		lastPercentage = 0;
	}

	@Override
	public void reasonerTaskProgressChanged(int value, int max) {
		if (max > 0) {
			int percent = value * 100 / max;
			if (lastPercentage != percent && percent % 1 == 0) {
				log.info(percent + "%");
				lastPercentage = percent;
			}
		}
	}

	@Override
	public void reasonerTaskBusy() {
		log.info("busy...");
	}

}
